package com.lg.cf;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/4/18 9:08
 */
public class CF915EPhysicalEducationLessons {

    private static final int N = (int) (1e9 + 10);
    private static SegmentTree root = new SegmentTree(1, N, 1);
    private static int n, m;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        //TODO Java TLE；C++ MLE
        n = nextInt();
        m = nextInt();
        modify(root, 1, n, 1);
        for (int i = 0; i < m; i++) {
            int l = nextInt(), r = nextInt(), k = nextInt();
            if (k == 1) modify(root, l, r, 0);
            else modify(root, l, r, 1);
            writer.println(root.sum);
            writer.flush();
        }
        writer.flush();
    }

    private static void pushdown(SegmentTree root) {
        if (root.lazy) {
            root.left().val = root.right().val = root.val;
            root.left().sum = (root.left().r - root.left().l + 1) * root.left().val;
            root.right().sum = (root.right().r - root.right().l + 1) * root.right().val;
            root.left().lazy = root.right().lazy = true;
            root.lazy = false;
        }
    }

    private static void pushup(SegmentTree root) {
        root.sum = root.left().sum + root.right().sum;
    }

    private static void modify(SegmentTree root, int l, int r, int val) {
        if (l <= root.l && r >= root.r) {
            root.val = val;
            root.sum = (root.r - root.l + 1) * root.val;
            root.lazy = true;
        } else {
            pushdown(root);
            int mid = root.l + root.r >> 1;
            if (l <= mid) modify(root.left(), l, r, val);
            if (r > mid) modify(root.right(), l, r, val);
            pushup(root);
        }
    }

    private static class SegmentTree {
        private int l, r, val, sum;
        private boolean lazy;
        private SegmentTree lc, rc;

        public SegmentTree(int l, int r, int val) {
            this.l = l;
            this.r = r;
            this.val = val;
        }

        public SegmentTree left() {
            if (lc == null) {
                int mid = l + r >> 1;
                lc = new SegmentTree(l, mid, val);
            }
            return lc;
        }

        public SegmentTree right() {
            if (rc == null) {
                int mid = l + r >> 1;
                rc = new SegmentTree(mid + 1, r, val);
            }
            return rc;
        }
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
